package com.delicious.servlet;

import java.io.IOException;
import java.util.List;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.delicious.dao.impl.NewsDaoImpl;
import com.delicious.entity.News;

public class NewsDetailsServlet extends HttpServlet {

	
	public void doGet(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {
		int rowNo = Integer.parseInt(request.getParameter("rowNo"));
		request.setAttribute("rowNo", rowNo);
		
		News list = new NewsDaoImpl().getNewsByRowNo(rowNo);
		request.setAttribute("news", list);
		
		int rows = new NewsDaoImpl().getNewsPaging(0,0).size();
		request.setAttribute("rows", rows);
		request.getRequestDispatcher("newsDetails.jsp").forward(request, response);
	}

}
